<?php

/**
 * FotoArticulo form.
 *
 * @package    catalogo
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class FotoArticuloForm extends BaseFotoArticuloForm
{
  public function configure()
  {
    $this->useFields(array('nombre'));

    $this->widgetSchema['nombre'] = new sfWidgetFormInputFileEditable(array(
      'label'     => ' ',
      'file_src'  => sfConfig::get('app_upload_dir_foto_art').sfConfig::get('app_upload_dir_foto_art_dest').'/'.$this->getObject()->getNombre(),    
      'is_image'  => true,
      'edit_mode' => !$this->isNew(),
      'template'  => '<div class="foto">%file%<br/>%input%<br/>%delete% Eliminar esta foto</div>',
    ));
    
    $this->widgetSchema->setLabel('nombre', 'Foto');       
    $this->validatorSchema['nombre_delete'] = new sfValidatorPass(); 
    $this->validatorSchema['nombre'] = new sfValidatorFile(array( 
        'required' => true, 
        'path' => sfConfig::get('sf_upload_dir').'/articulos', 
        'mime_types' => 'web_images',
        'required' => false,
        'validated_file_class' => 'sfValidatedFileCustom' 
    ));          
  }
}
